﻿$(function () {
    $("#btnLogin").validate_("click", {
        rules: {
            "#txtUserName": { name: "用户名", minlength: 6, maxlength: 12, style: "letterNum" },
            "#txtUserPwd": { name: "密码", minlength: 6, maxlength: 12, style: "letterNum" }
        },
        errorPlacement: function (error, element) {
            element.siblings("span").empty().append(error);
        },
        ajax: {
            goal: "/Home/Login",
            param: {
                name: $("#txtUserName").val(),
                password: $("#txtUserPwd").val(),
                validateCode: $("#txtAuthCode").val(),
                url: ""
            },
            callBack: function (data, status) {
                if (status != "success") {
                    alert("网络异常，请重试！");
                    return;
                }
                alert(data);
            }
        }
    });
});

$(function () {
    $("#btnChangeAuthCode").click(function () {
        $("#imgAuthCode").attr("src", "/Home/AuthCode/" + new Date().getTime());
    });
});
